package com.infolab.aims.common.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class SearchCriteria implements Serializable {
	
	private Integer curPage;
	
	private Integer maxRow;
	
	private Map<String,Object> search = new HashMap<String, Object>();
	
	private String sortType;
	
	private String sortName;
	
	
	public Integer getCurPage() {
		return curPage;
	}

	public void setCurPage(Integer curPage) {
		this.curPage = curPage;
	}

	public Integer getMaxRow() {
		return maxRow;
	}

	public void setMaxRow(Integer maxRow) {
		this.maxRow = maxRow;
	}

	public Map<String, Object> getSearch() {
		return search;
	}

	public void setSearch(Map<String, Object> search) {
		this.search = search;
	}

	public String getSortType() {
		return sortType;
	}

	public void setSortType(String sortType) {
		this.sortType = sortType;
	}

	public String getSortName() {
		return sortName;
	}

	public void setSortName(String sortName) {
		this.sortName = sortName;
	}
	
	public boolean isAscendingSort()
	{
		return StringUtils.equalsIgnoreCase(sortType,SORTTYPE_ASC);
	}
	
	public boolean isDescendingSort()
	{
		return StringUtils.equalsIgnoreCase(sortType, SORTTYPE_DESC);
	}
	
	public Object getSearchCriteria(String key)
	{
		if(search==null) return null;
		return search.get(key);
	}
	
	public void addSearchCriteria(String key,Object value)
	{
		search.put(key, value);
	}
	
	
	public static final String SORTTYPE_ASC="asc";
	public static final String SORTTYPE_DESC="desc";
	
}
